//
//  ChatDemoHelper.h
//  ChatDemo-UI3.0
//
//  Created by EaseMob on 15/12/8.
//  Copyright © 2015年 EaseMob. All rights reserved.
//
#import <Foundation/Foundation.h>

#import "ConversationListController.h"
#import "ChatViewController.h"
#import "CallViewController.h"
#import <Hyphenate/EMCallManagerDelegate.h>
#import <UserNotifications/UserNotifications.h>

#import "HXTabBarController.h"
////两次提示的默认间隔
//static const CGFloat kDefaultPlaySoundInterval = 3.0;
//static NSString *kMessageType = @"MessageType";
//static NSString *kConversationChatter = @"ConversationChatter";
//static NSString *kGroupName = @"GroupName";

@protocol ChatDemoHelpDelegate <NSObject>

/**
 是否自定义响铃:默认为YES，

 @return 响铃／静音
 */
- (BOOL)customPlaySoundAndVibration:(NSString *)from;

/**
 接收到cmd类型的消息，工作圈中需要刷新本地数据库中数据
 类似一种指令型的消息。比如您的服务器要通知客户端做某些操作，您可以服务器和客户端提前约定好某个字段，当客户端收到约定好的字段时，执行某种特殊操作。
 */
- (void)cmdMessagesReceived;

@end


@interface ChatDemoHelper : NSObject <EMClientDelegate,EMChatManagerDelegate,EMContactManagerDelegate,EMGroupManagerDelegate,EMChatroomManagerDelegate,EMCallManagerDelegate>

@property (nonatomic,strong) id<ChatDemoHelpDelegate> helperDelegate;

@property (nonatomic) ConversationListController *conversationListVC;

//@property (nonatomic, weak) MainHomeViewController *mainVC;
@property (nonatomic) HXTabBarController *mainVC;

@property (nonatomic) ChatViewController *chatVC;

@property (strong, nonatomic) NSObject *callLock;
@property (strong, nonatomic) EMCallSession *callSession;
@property (strong, nonatomic) CallViewController *callController;

+ (instancetype)shareHelper;

- (void)asyncPushOptions;

- (void)asyncGroupFromServer;

- (void)asyncConversationFromDB;

+ (void)updateCallOptions;

- (void)makeCallWithUsername:(NSString *)aUsername
                        type:(EMCallType)aType;

- (void)hangupCallWithReason:(EMCallEndReason)aReason;

- (void)answerCall:(NSString *)aCallId;

- (void)dismissCurrentCallController;
/**
 是否存在聊天界面
 
 @return <#return value description#>
 */
- (BOOL)isChatViewController;

/**
 获取当前的聊天界面
 
 @return <#return value description#>
 */
- (ChatViewController*)_getCurrentChatView;

- (BOOL)isSlientForMessageFromUser:(NSString *)from;

#pragma mark -- 收到本地通知，调用前需要给属性 mainVC 设置具体值
- (void)jumpToChatList;
- (void)didReceiveLocalNotification:(UILocalNotification *)notification;
- (void)didReceiveUserNotification:(UNNotification *)notification;



@end
